<html>

<head>
  <script src="subresources/script.js"></script>
</head>

<body>
  <script type="text/javascript">

    // Returns a cross origin child frame url for the given |path|.
    function getCrossOriginChildFrameUrl(path) {
      var url = '';

      // Scheme.
      url += window.location.protocol + '//';

      // Host.
      url += 'third_party_host.com';

      // Port.
      if (window.location.port)
        url += ':' + window.location.port;

      // Path.
      url += path;

      return url;
    }

    // Appends two iframes to the document, one cross-origin and the other
    // same-origin.
    function createTwoFrames() {
      var iframe1 = document.createElement('iframe');
      iframe1.name = 'frame1';
      iframe1.src = getCrossOriginChildFrameUrl('/child_frame.html?frame=1');
      iframe1.width = 20;
      iframe1.height = 20;
      document.body.appendChild(iframe1);

      var iframe2 = document.createElement('iframe');
      iframe2.name = 'frame2';
      iframe2.src = '/child_frame.html?frame=2';
      iframe2.width = 20;
      iframe2.height = 20;
      document.body.appendChild(iframe2);
    }

    createTwoFrames();
  </script>
</body>

</html>
